using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using SBPweb.Contracts.StateManagement;

namespace SBPweb.Modules.StateManagement.Controls
{
	public partial class StatusSelectorControl : ComboBox
	{
		public StatusSelectorControl()
		{
			InitializeComponent();
			this.DrawMode = DrawMode.OwnerDrawFixed;
			this.DrawItem += new DrawItemEventHandler(DrawItemHandler);
		}

		private void DrawItemHandler(object sender, System.Windows.Forms.DrawItemEventArgs e)
		{
			Graphics g = e.Graphics;
			Rectangle r = e.Bounds;
			if (this.Items[e.Index] is IState)
			{

				if (e.Index >= 0)
				{
					//TODO: implement this
					//Rectangle rd = r;
					//rd.Width = rd.Left + 100;

					//Rectangle rt = r;
					//r.X = rd.Right;

					//SolidBrush b = (SolidBrush)colorArray[e.Index];
					//g.FillRectangle(b, rd);
					//StringFormat sf = new StringFormat();
					//sf.Alignment = StringAlignment.Near;

					//Console.WriteLine(e.State.ToString());
					//e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.Black), 2), r);
					//if (e.State == (DrawItemState.NoAccelerator | DrawItemState.NoFocusRect))
					//{
					//    e.Graphics.FillRectangle(new SolidBrush(Color.White), r);
					//    e.Graphics.DrawString(b.Color.Name, new Font("Ariel", 8, FontStyle.Bold), new SolidBrush(Color.Black), r, sf);
					//    e.DrawFocusRectangle();
					//}
					//else
					//{
					//    e.Graphics.FillRectangle(new SolidBrush(Color.LightBlue), r);
					//    e.Graphics.DrawString(b.Color.Name, new Font("Veranda", 12, FontStyle.Bold), new SolidBrush(Color.Red), r, sf);
					//    e.DrawFocusRectangle();
					//}
				}
			}
			else
			{
								
			}
		}



	}
}
